<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>修改等级</title>
<link href="__PUBLIC__/admin/css/xc.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/admin/css/xc.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/common-1.0.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.js"></script> 
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.admin.js"></script>

</head>
<body>
<div class="pd-5">
  <form action="#" method="post" class="form form-horizontal" id="myform">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>等级名称：</label>
      <div class="formControls col-7">
        <input type="text" id="gr_name" name="gr_name" value="{$re.gr_name}" class="input-text" placeholder="请输入等级名称">
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>报单金额：</label>
      <div class="formControls col-7">
        <input type="text" id="gr_money" name="gr_money" value="{$re.gr_money}" class="input-text" placeholder="请输入报单金额">
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>静态积分：</label>
      <div class="formControls col-7">
        <input type="text" id="gr_frozen" name="gr_frozen" value="{$re.gr_frozen}" class="input-text" placeholder="请输入静态积分">
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>消费一代释放比例：</label>
      <div class="formControls col-7">
        <input type="text" id="gr_order" name="gr_order" value="{$re.gr_order}" class="input-text" placeholder="请输入消费释放比例">
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>消费二代释放比例：</label>
      <div class="formControls col-7">
        <input type="text" id="gr_order1" name="gr_order1" value="{$re.gr_order1}" class="input-text" placeholder="请输入消费释放比例">
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>直推释放：</label>
      <div class="formControls col-7">
        <input type="text" id="gr_recom2" name="gr_recom2" value="{$re.gr_recom2}" class="input-text" >
      </div>
    </div>
    <input type="hidden" id="id" name="id" value="{$re.gr_id}">
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <button type="button" id="sub" name="sub" class="btn btn-primary radius" onClick="checkSubmit()"><i class='Hui-iconfont'>&#xe632;</i> 保存</button>
        <button class="btn btn-default radius" type="button" onClick="layer_close();"><i class='Hui-iconfont'>&#xe66b;</i> 取消</button>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript">
//按回车件触发提交
document.onkeydown=function(event){
	var e = event || window.event || arguments.callee.caller.arguments[0];
	if(e && e.keyCode==13){ // enter 键
		checkSubmit();
	}
}; 
//提交数据
function checkSubmit()
{
	var gr_name = $.trim($('#gr_name').val());
	if(gr_name == ''){
		layer.msg('等级名称不能为空!', {icon: 2});
		return false;
	}
	$.ajax({
		type : 'post',
		url : "{:U('User/gradeAddEdit')}",
		data : $("#myform").serialize(),
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				layer.msg(res.msg,{icon:1,time:2000},function(){
					// 先获取窗口索引，才能关闭窗口  
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
				window.parent.location.reload(); //刷新父页面
			}else{
				layer.msg(res.msg, {icon: 2});
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			layer.alert('网络失败，请刷新页面后重试',{icon:2});
		}
	})
}

</script>
</body>
</html>